package com.huangpuweb.api.test;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;


public class ApiTest1{
    //http://localhost:8080/HuangpuWebApi_war_exploded/
    private String host = "http://localhost:8080/HuangpuWebApi_war_exploded";
//    private String host = "http://172.82.4.51:8080";
//    private String host="http://172.82.16.1/city_center/city";
//    private String host="http://localhost:8080/springmvcdemo_war_exploded";
//private String host="http://47.94.235.130:8080";
    private HttpURLConnection conn;

    private void init(String url) throws Exception {
        if (conn != null) conn.disconnect();
        conn = (HttpURLConnection) new URL(url).openConnection();
        conn.setDoOutput(true);
        conn.setRequestMethod("POST");
        conn.setRequestProperty("content-type", "application/x-www-form-urlencoded");
        conn.setConnectTimeout(10000);
        conn.setReadTimeout(10000);
    }

    public void sendOutput(String value) throws Exception {
        System.out.println("sendOutput=========================================");
        System.out.println("value:" + value);
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(conn.getOutputStream()));
        writer.write(value);
        writer.close();
    }

    public void printlnInput() throws Exception {
        int code = conn.getResponseCode();
        InputStream in = null;
        if (code == 200) {
            in = conn.getInputStream();
        } else {
            in = conn.getErrorStream();
        }
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        StringBuilder builder = new StringBuilder();
        String value = reader.readLine();
        while (value != null) {
            builder.append(value);
            value = reader.readLine();
        }
        reader.close();
        System.out.println("printlnInput=========================================");
        System.out.println("basestring:" + builder.toString().trim());
        if (code == 200) {
            value = builder.toString();
        }
        System.out.println("ResponseCode:" + code);
        System.out.println("ContentType:" + conn.getContentType());
        System.out.println("value:" + value);
        System.out.println("printlnInput OK=========================================");
    }


    public void fireapioverview(String input) throws Exception {
        init(host + "/api/fireapioverview");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getLaJiEventDataPush(String input) throws Exception {
        init(host + "/api/getLaJiEventDataPush");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void readFile(String input) throws Exception {
        init(host + "/api/readFile");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }



    public void overview(String input) throws Exception {
        init(host + "/overview");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getUserCarIdByMac(String input) throws Exception {
        init(host + "/getUserCarIdByMac");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getAllHpDianZhaoDianPaiInfo(String input) throws Exception {
        init(host + "/shiGongAnQuan/getAllHpDianZhaoDianPaiInfo");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getAllHpDianZhaoDianPaiInfoByLevel(String input) throws Exception {
        init(host + "/shiGongAnQuan/getAllHpDianZhaoDianPaiInfoByLevel");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getShiGongAnQuanBuildingList(String input) throws Exception {
        init(host + "/shiGongAnQuan/getShiGongAnQuanBuildingList");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getAllEmergencyZhaMen(String input) throws Exception {
        init(host + "/emergency/getAllEmergencyZhaMen");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getShiGongMapEventItem(String input) throws Exception {
        init(host + "/shiGongAnQuan/getShiGongMapEventItem");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getAllEmergencyEventV2(String input) throws Exception {
        init(host + "/emergency/getAllEmergencyEventV2");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getAllEmergencyFireControlStation(String input) throws Exception {
        init(host + "/emergency/getAllEmergencyFireControlStation");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getAllEmergencyEvent(String input) throws Exception {
        init(host + "/emergency/getAllEmergencyEvent");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getEmergencyEventCountByMonth(String input) throws Exception {
        init(host + "/emergency/getEmergencyEventCountByMonth");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getEmergencyEventCountByType(String input) throws Exception {
        init(host + "/emergency/getEmergencyEventCountByType");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getMapEventItem(String input) throws Exception {
        init(host + "/emergency/getMapEventItem");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getAllRoadInfoData(String input) throws Exception {
        init(host + "/crowd/getAllRoadInfoData");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getSpotRoadInfoData(String input) throws Exception {
        init(host + "/crowd/getSpotRoadInfoData");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getHpTest(String input) throws Exception {
        init(host + "/crowd/getHpTest");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getAllSpotEveryHourData(String input) throws Exception {
        init(host + "/crowd/getAllSpotEveryHourData");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }



    public void getSpotLastSevenMaxNumberData(String input) throws Exception {
        init(host + "/crowd/getSpotLastSevenMaxNumberData");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getAllDataInfoByLBS(String input) throws Exception {
        init(host + "/crowd/getAllDataInfoByLBS");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getAllDataInfoByGaJl(String input) throws Exception {
        init(host + "/crowd/getAllDataInfoByGaJl");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getAllDataInfoByGaJq(String input) throws Exception {
        init(host + "/crowd/getAllDataInfoByGaJq");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getAllhpPublicVideo(String input) throws Exception {
        init(host + "/crowd/getAllhpPublicVideo");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void crowdgetRealTimeNumber(String input) throws Exception {
        init(host + "/crowd/getRealTimeNumber");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getSubwayFlowData(String input) throws Exception {
        init(host + "/crowd/getSubwayFlowData");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getParkInfoRealTimeData(String input) throws Exception {
        init(host + "/crowd/getParkInfoRealTimeData");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getEmergencyEventCountByYear(String input) throws Exception {
        init(host + "/emergency/getEmergencyEventCountByYear");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getTopYearEventList(String input) throws Exception {
        init(host + "/emergency/getTopYearEventList");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getBlmqUseNatureOrderDesc(String input) throws Exception {
        init(host + "/crowd/getBlmqUseNatureOrderDesc");
        sendOutput(input);
        printlnInput();
        conn.disconnect();


    }

    public void getBlmqUseNatureLevel(String input) throws Exception {
        init(host + "/crowd/getBlmqUseNatureLevel");
        sendOutput(input);
        printlnInput();
        conn.disconnect();


    }




    public void getDianZaoDianPaiMap(String input) throws Exception {
        init(host + "/emergency/getDianZaoDianPaiMap");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getTop5EventListV2(String input) throws Exception {
        init(host + "/emergency/getTop5EventListV2");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getTop5EventList(String input) throws Exception {
        init(host + "/emergency/getTop5EventList");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getXiaofangData(String input) throws Exception {
        init(host + "/crowd/getXiaofangData");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getXiaofangYearData(String input) throws Exception {
        init(host + "/crowd/getXiaofangYearData");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getXiaofangTypeData(String input) throws Exception {
        init(host + "/crowd/getXiaofangTypeData");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getXiaofangTypeDetailData(String input) throws Exception {
        init(host + "/crowd/getXiaofangTypeDetailData");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getXiaofangKeyData(String input) throws Exception {
        init(host + "/crowd/getXiaofangKeyData");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getXiaofangAjAreaData(String input) throws Exception {
        init(host + "/crowd/getXiaofangAjAreaData");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getXiaofangAjHotAreaData(String input) throws Exception {
        init(host + "/crowd/getXiaofangAjHotAreaData");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }



    public void getRoadPredData(String input) throws Exception {
        init(host + "/crowd/getRoadPredData");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getXiaofangAjDataByStation(String input) throws Exception {
        init(host + "/crowd/getXiaofangAjDataByStation");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getXiaofangTypeDataForYear(String input) throws Exception {
        init(host + "/crowd/getXiaofangTypeDataForYear");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getBlmqHeight(String input) throws Exception {
        init(host + "/crowd/getBlmqHeight");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getBlmqSize(String input) throws Exception {
        init(host + "/crowd/getBlmqSize");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getBlmqGlassType(String input) throws Exception {
        init(host + "/crowd/getBlmqGlassType");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getBlmqGlassCheck(String input) throws Exception {
        init(host + "/crowd/getBlmqGlassCheck");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }
    public void getBlmqGlassSTRUCTURE(String input) throws Exception {
        init(host + "/crowd/getBlmqGlassSTRUCTURE");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getBlmqGlassCheckQu(String input) throws Exception {
        init(host + "/crowd/getBlmqGlassCheckQu");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getBlmqGlassCheckOwn(String input) throws Exception {
        init(host + "/crowd/getBlmqGlassCheckOwn");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getBlmqGlassEventPush(String input) throws Exception {
        init(host + "/crowd/getBlmqGlassEventPush");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getAliPersonDataByList(String input) throws Exception {
        init(host + "/crowd/getAliPersonDataByList");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getErrorBuildInfoByBuildId(String input) throws Exception {
        init(host + "/crowd/getErrorBuildInfoByBuildId");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getSysLargeBuildingData(String input) throws Exception {
        init(host + "/shiGongAnQuan/getSysLargeBuildingData");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }
    public void getSysLargeBuildingStreetData(String input) throws Exception {
        init(host + "/shiGongAnQuan/getSysLargeBuildingStreetData");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getSysLargeBuildingTypeData(String input) throws Exception {
        init(host + "/shiGongAnQuan/getSysLargeBuildingTypeData");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getSysZhuangShiTypeData(String input) throws Exception {
        init(host + "/shiGongAnQuan/getSysZhuangShiTypeData");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getSysZhuangShiListData(String input) throws Exception {
        init(host + "/shiGongAnQuan/getSysZhuangShiListData");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getErrorShopById(String input) throws Exception {
        init(host + "/laoximenapi/getErrorShopById");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void operateLngLatByStreetElevatorAddress(String input) throws Exception {
        init(host + "/laoximenapi/operateLngLatByStreetElevatorAddress");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getOperateShopData(String input) throws Exception {
        init(host + "/laoximenapi/getOperateShopData");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getHpDianZhaoDianPaiInfoStreetByShopName(String input) throws Exception {
        init(host + "/laoximenapi/getHpDianZhaoDianPaiInfoStreetByShopName");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }



    public void getErrorSignageListByType(String input) throws Exception {
        init(host + "/laoximenapi/getErrorSignageListByType");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getListUnitByData(String input) throws Exception {
        init(host + "/shiGongAnQuan/getListUnitByData");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getHpDianZhaoDianPaiInfoStreetByRoadName(String input) throws Exception {
        init(host + "/laoximenapi/getHpDianZhaoDianPaiInfoStreetByRoadName");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getHpDianZhaoDianPaiInfoStreetByspecification(String input) throws Exception {
        init(host + "/laoximenapi/getHpDianZhaoDianPaiInfoStreetByspecification");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void operateLngLatByFirControlAddress(String input) throws Exception {
        init(host + "/api/operateLngLatByFirControlAddress");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }

    public void getXiaoGongChengUrlByName(String input) throws Exception {
        init(host + "/api/getXiaoGongChengUrlByName");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }


    public void getEmergencyResourceV2(String input) throws Exception {
        init(host + "/emergency/getEmergencyResourceV2");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }



    public void getEmergencyResourceXJTRescueTeam(String input) throws Exception {
        init(host + "/emergency/getEmergencyResourceXJTRescueTeam");
        sendOutput(input);
        printlnInput();
        conn.disconnect();
    }




    public static void main(String[] args) throws Exception {
        long start = System.nanoTime();
        ApiTest1 test = new ApiTest1();
        String getEmergencyResourceXJTRescueTeam="{\"eventid\":\"315\"}";
        String getSpotRoadInfoData="{\"spotCode\":\"SHHPQ_WAITAN\"}";
        String page=  "{\"app_key\":\"bda5d74d824d46f48471a3e9f24ed299\",\"format\":\"json\",\"sign\":\"F697C5F6FD3D01633D607603ED8D54EB\",\"sign_method\":\"md5\",\"timestamp\":1595815810,\"v\":\"1.0\"}";
        String getUserCarIdByMac=  "{\"mac\":\"5CF8CF4B-9889-87C8-48C1-4F3C38B235DC\"}";
        String getParkInfoRealTimeData = "{\"spotCode\":\"SHHPQ_WAITAN\",\"parkId\":\"hp31010100039\"}";
        String getLaJiEventDataPush = "{\"url\":\"SHHPQ_WAITAN\",\"deviceId\":\"1056\",\"deviceName\":\"1056\",\"area\":\"1056\",\"eventType\":\"1056\",\"eventTime\":\"1056\"}";
        String getSpotLastSevenMaxNumberData = "{\"spotCode\":\"SHHPQ_YUYUAN_WAIQUAN\"}";
        String setKugooInfo = "{\"phonecompany\":\"phonecompany\",\"phonetype\":\"phonetype\",\"phonesystem\":\"phonesystem\",\"phoneimei\":\"phoneimei\"}";
        String setKugooBlueInfo = "{\"deviceid\":\"1\",\"mac\":\"mac\",\"companycode\":\"companycode\"}";
        String checkAppkeyAndPackage = "{\"appkey\":\"15825267071404664\",\"packagename\":\"Kugoo\"}";
//		String getAuthInfo="{\"data\":{\"url\":\"http://www.baidu.com\",\"appid\":\"ww805e7a0894cc9f84\"}}";
//		String getMatchUserList="{\"data\":{\"wxuserid\":\"wm0dEaDAAArpfoJVrVl2ZqEoRFcmE4qQ\",\"pid\":\"100000360484\"}}";
//		test.getreportList(getreportList);
//      String getIposRecord="{\"currentpage\":\"1\",\"startDate\":\"2014-3-20\",\"endDate\":\"2014-3-20\",\"iposHwNo\":\"q343\",\"sn\":\"\"}";
//		test.getUserListTest(getlogin);
//		test.getlogin(getlogin);
//		test.getUserOffligetRuiYunUserInfoneOrderList(getUserOfflineOrderList);
        test.getLaJiEventDataPush(getLaJiEventDataPush);
        long t = System.nanoTime() - start;
        System.out.println("调用消耗时间：" + t / 1000000000.0 + "秒");
    }
}